package com.ruifu.pls.config;

import com.ruifu.pls.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.text.ParseException;

/**
 * Created by Bob on 2017/8/9.
 */
@Configuration
@EnableAsync
@EnableScheduling
public class CronConfig {



    @Autowired
    SkuService skuService;

    @Autowired
    AsnheaderService asnheaderService;

    @Autowired
    DocOrderHeaderService orderHeaderService;
    @Autowired
    DocOrderHeaderAddService docOrderHeaderAddService;
    @Autowired
    InventoryService inventoryService;
    @Autowired
    StatusUpdateService statusUpdateService;

    @Scheduled(cron="0/10 * *  * * ?")
    //商品同步接口
    public void postSku() throws ParseException {
      // skuService.postSkuToGlink();
    }
    @Scheduled(cron="0/100 * *  * * ?")
    //wms同步即时库存
    public void postSkuTo() throws ParseException {
        //inventoryService.postInventoryToGLin();
    }
    //退货入库逆向新增
    @Scheduled(cron="0/10 * *  * * ?")
    public void asnReverseAddIn() throws ParseException {
       asnheaderService.asnReverseReturnAadd();
    }
   //入库逆向新增
    @Scheduled(cron="0/10 * *  * * ?")
    public void asnReverseAdd() throws ParseException {
       asnheaderService.asnReverseAdd();
    }
    //入库单确认
   @Scheduled(cron="0/10 * *  * * ?")
   public void asnReverse() throws ParseException {
      //asnheaderService.asnConform();
   }
    //正向退货入库确认
    @Scheduled(cron="0/10 * *  * * ?")
    public void asnReverseConform() throws ParseException {
       // asnheaderService.asnReturnConform();
    }
    //出库单新增接口
   @Scheduled(cron="0/10 * *  * * ?")
    public void odoReverse() throws ParseException {
       // docOrderHeaderAddService.postDocOrderHeaderToGlinAdd();
   }

   // 销售单新增接口
    @Scheduled(cron="0/10 * *  * * ?")
   public void odoReverseAdd() throws ParseException {
      //docOrderHeaderAddService.postDocOrderHeaderToGlinAddComform();
   }
    //销售单确认接口
   @Scheduled(cron="0/10 * *  * * ?")
   public void odoReverseComform() throws ParseException {
      // orderHeaderService.DocOrderConformToGlin();
   }

 //出库单确认接口
   @Scheduled(cron="0/10 * *  * * ?")
    public void InventoryEntry() throws ParseException {
      //orderHeaderService.postDocOrderHeaderToGlin();
    }


    //正向入库单确认
    @Scheduled(cron="0/10 * *  * * ?")
    public void asnConform() throws ParseException {
       // asnheaderService.asnConform();
    }



   //订单状态即时更新接口
    @Scheduled(cron="0/10 * *  * * ?")
       public void statusUpdate() throws ParseException {
        //statusUpdateService.GLinStatusUpdateIn();//入库
        //statusUpdateService.GLinStatusUpdateOut();//出库
       }


}
